using System.Data;
using Migrator.Framework;

namespace Bxo.Database {
    [Migration(200808200040)]
    public class M200808200040_CreateScenarioCategoryAssociationsTable : Migration {
        public override void Up() {
            this.Database.AddTable(
                    "ScenarioCategoryAssociations",
                    new Column("Scenario", DbType.Int32, ColumnProperty.NotNull),
                    new Column("Category", DbType.Int32, ColumnProperty.NotNull)
                    );
            this.Database.AddForeignKey("FK_ScenarioCategoryAssociations_Scenarios", "ScenarioCategoryAssociations", "Scenario", "Scenarios", "Id");
            this.Database.AddForeignKey("FK_ScenarioCategoryAssociations_Categories", "ScenarioCategoryAssociations", "Category", "Categories", "Id");
        }

        public override void Down() {
            this.Database.RemoveForeignKey("Categories", "FK_ScenarioCategoryAssociations_Categories");
            this.Database.RemoveForeignKey("Categories", "FK_ScenarioCategoryAssociations_Scenarios");
            this.Database.RemoveTable("Categories");
        }
    }
}